/**
 * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
 *
 * 
 * @param number long长整型 
 * @return long长整型
 */
 function cutRope( number ) {
  // write code here
  if(number === 2) return 1
  if(number === 3) return 2
  if(number === 4) return 4
  var cnt = Math.floor(number / 3)
  if(number % 3 === 0){
    return Number(getPowRes(cnt))
  }else if(number % 3 === 1){
    return Number(getPowRes(cnt-1)) * 4 % 998244353
  }else {
    return Number(getPowRes(cnt)) * 2 % 998244353
  }
}
function getPowRes(cnt){
  if(cnt === 0) return 1
  var remainer = cnt % 2
  var halfCnt = Math.floor(cnt / 2)
  var partCnt = BigInt(getPowRes(halfCnt))
  if(remainer === 0){
    return BigInt((partCnt * partCnt)) % 998244353n
  }
  return 3n * BigInt((partCnt * partCnt)) % 998244353n
}
module.exports = {
  cutRope : cutRope
};